def is_leap_year(year):
    return year % 4 == 0 and year % 100 != 0 or year %400 == 0


def which_day(year, month, day):
    days_of_month = [
        [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
        [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    ][is_leap_year(year)]  #闰年就是days_of_month[1],平年就是ays_of_month[0]

    total = 0
    for i in range(month-1):
        total += days_of_month[i]
    return total + day

print(which_day(2020,12,31))